'use strict';

// const fs = require('fs');
import { list } from './root.model';


export async function index(ctx, next) {
  let data = await list();
  console.log('index', ctx.request.url);
  if (ctx.request.url === '/') {
    await ctx.render('index', {
      title: 'test'
    });
    await next();
    return;
  }
  ctx.status = 200;
  ctx.body = data;
  await next();
}
